<style>
    #aLibraryTransfer {
        width: 100%;
        min-width: 890px;
        position: relative;
    }

    #aLibraryTransfer .demo-table-expand {
        font-size: 0;
    }

    #aLibraryTransfer .demo-table-expand label {
        width: 90px;
        color: #99a9bf;
    }

    #aLibraryTransfer .demo-table-expand .el-form-item {
        margin-right: 0;
        margin-bottom: 0;
        width: 80%;
    }

    #aLibraryTransfer .el-table__expand-column .el-table__expand-icon {
        height: 39px;
    }

    #aLibraryTransfer .table {
        transition: 1s all;
    }

    #aLibraryTransfer .el-carousel__container {
        height: 440px;
    }

    .el-tooltip__popper {
        max-width: 400px;
    }

    .el-step__main {
        max-width: calc(100% - 60px);
    }

    #aLibraryTransfer .aLibraryTransferTable {
        width: 95% !important;
        margin: 20px auto;
    }

    #aLibraryTransfer .datePicker {
        width: 140px !important;
        height: 24px !important;
        margin-top: 29px;
        margin-right: 18px;
        float: left;
    }

    #aLibraryTransfer .datePicker .el-input__inner {
        border-radius: 2px !important;
        height: 24px !important;
    }

    #aLibraryTransfer .add {
        background: url("/static/images/add.png") no-repeat center;
    }

    #aLibraryTransfer .del {
        background: url("/static/images/del.png") no-repeat center;
    }

    #aLibraryTransfer .search {
        background: url("/static/images/search.png") no-repeat center;
    }

    #aLibraryTransfer .sel {
        background: url("/static/images/sel.png") no-repeat center;
    }

    #aLibraryTransfer .icon {
        float: left;
    }

    #aLibraryTransfer .btn span {
        float: left;
        margin-top: 4px;
        margin-left: 2px;
    }

    #aLibraryTransfer .btn-nav {
        height: 60px;
        overflow: hidden;
    }

    #aLibraryTransfer .btn {
        height: 24px;
        line-height: 1;
        border: none;
        background: #f8fafb;
        outline: none;
        cursor: pointer;
        padding: 0;
        margin: 0;
        font-size: 14px;
        color: #1f2d3d;
        margin-top: 29px;
        margin-right: 16px;
    }

    #aLibraryTransfer .btn-print {
        margin-right: 0;
    }

    #aLibraryTransfer .btn:hover {
        color: #5468ee;
    }

    #aLibraryTransfer .inner {
        margin: 0 20px;
    }

    #aLibraryTransfer .btn-nav .el-input .el-input__inner {
        height: 24px;
    }

    #aLibraryTransfer .btn-nav .el-input {
        float: left;
        margin-top: 29px;
        margin-right: 18px;
        width: 140px;
        height: 24px;
    }
</style>
<style>
    .steps {
        position: absolute;
        bottom: 10px;
        left: 30px;
        margin: auto;
    }

    .el-dialog__headerbtn {
        position: absolute;
        right: 25px;
        top: 15px;
    }

    .el-step__main {
        margin-left: -8px !important;
    }
</style>
<style>
    #aLibraryTransfer .el-dialog .btn-nav {
        height: 35px;
    }

    #aLibraryTransfer .el-dialog .btn-nav .el-input {
        margin-top: 0;
    }

    #aLibraryTransfer .el-dialog .el-table {
        width: 98%;
        margin: 0 1%;
    }

    #aLibraryTransfer .el-input-number__decrease, .el-input-number__increase {
        top: 3px;
    }

    #aLibraryTransfer .el-slider {
        width: 400px !important;
    }
</style>
<div id="aLibraryTransfer">
    <!--页面调整-->
    <el-row v-loading="showLoading"
            element-loading-text="拼命加载中">
        <el-col :span="24">
            <div class="inner btn-nav">
                <el-input
                        v-model="zyMentionUserName"
                        icon="search"
                        placeholder="提起人"></el-input>
                <el-input
                        v-model="zyCreateUserName"
                        icon="search"
                        placeholder="创建人"></el-input>
                <el-date-picker
                        v-model="date"
                        type="daterange"
                        align="right"
                        placeholder="创建日期"
                        class="datePicker"
                        :picker-options="pickerOptions">
                </el-date-picker>
                <el-select
                        v-model="zyStatus"
                        placeholder="请选择">
                    <el-option label="全部" :value.number="-1"></el-option>
                    <el-option label="未确认" :value.number="0"></el-option>
                    <el-option label="已确认" :value.number="1"></el-option>
                </el-select>
                <el-select
                    @visible-change="selectReturn"
                    v-model="zyArehouseId"
                    placeholder="请选择所属仓库">
                <el-option :label="obj.baName" :value="obj.baArehouseId"
                           v-for="obj of baseArehouses"></el-option>
            </el-select>
                <button @click="newInput" class="btn btn-add"><i
                        class="icon add"></i><span>新增</span>
                </button>
                <button @click="multiSelectClick" class="btn btn-multiSelect"><i
                        class="icon sel"></i><span>多选</span>
                </button>
                <button @click="multiMoreOperationDelete" class="btn btn-del" v-show="multiSelect"><i
                        class="icon del"></i><span>批量删除</span>
                </button>
            </div>
            <el-table
                    :data="aLibraryTransfer"
                    :default-sort="{prop: 'sjsj', order: 'descending'}"
                    :max-height="config_table_height()"
                    ref="table"
                    @expand="expandChange"
                    class="aLibraryTransferTable"
                    @selection-change='multiSelectionChange'
                    style="width: 100%">
                <el-table-column
                        type="expand">
                    <template scope="props">
                        <el-carousel
                                arrow="hover"
                                height="280px"
                                indicator-position="none"
                                :autoplay="false">
                            <el-carousel-item>
                                <el-row>
                                    <h3>库存转移详细</h3>
                                </el-row>
                                <el-form label-position="left" inline class="demo-table-expand">
                                    <el-row>
                                        <el-col :span="10">
                                            <el-form-item label="创建时间">
                                        <span>
                                            <el-icon name="time"></el-icon>
                                            {{auto_time_new(props.row.zyCreateTime,6) }}
                                        </span>
                                            </el-form-item>
                                            <el-form-item label="提起人">
                                                <span>{{ props.row.zyMentionUserName }}</span>
                                            </el-form-item>
                                            <el-form-item label="创建人">
                                                <span>{{props.row.zyCreateUserName}}</span>
                                            </el-form-item>
                                            <el-form-item label="确认人">
                                                <span>{{props.row.zyConfirmUserName}}</span>
                                            </el-form-item>
                                        </el-col>
                                        <el-col :span="10" :offset="2">
                                            <el-form-item label="转移原因">
                                                <span>{{ props.row.zyReason	 }}</span>
                                            </el-form-item>
                                            <el-form-item
                                                    v-if="props.row.zyStatus==0"
                                                    label="确认时间">
                                        <span>
                                            <el-icon name="time"></el-icon>
                                            {{ auto_time_new(props.row.zyConfirmTime,6) }}
                                        </span>
                                            </el-form-item>
                                            <el-form-item label="转移状态">
                                                <el-tag-s :val="auto_el_tag('zyStatus',props.row.zyStatus)"></el-tag-s>
                                            </el-form-item>
                                            <el-form-item
                                                    v-if="props.row.zyStatus==0"
                                                    label="可用操作">
                                                <el-button
                                                        size="small"
                                                        icon="edit"
                                                        v-if="false"
                                                        @click="inlineEdit(props.$index, props.row)">
                                                </el-button>
                                                <el-button
                                                        size="small"
                                                        type="danger"
                                                        @click="inlineDelete(props.$index, props.row)">删除
                                                </el-button>
                                            </el-form-item>
                                        </el-col>
                                    </el-row>
                                </el-form>
                            </el-carousel-item>
                            <el-carousel-item>
                                <el-table
                                        :data="props.row.zyDocsList">
                                    <el-table-column
                                            type="index"
                                            width="55">
                                    </el-table-column>
                                    <el-table-column
                                            label="货品编号"
                                            width="150"
                                            show-overflow-tooltip
                                            align="center"
                                            prop="mfunRepertory.baseGoods.bgGoodsNo">
                                    </el-table-column>
                                    <el-table-column
                                            label="货品名称"
                                            show-overflow-tooltip
                                            align="center"
                                            prop="mfunRepertory.baseGoods.bgGoodsName">
                                    </el-table-column>
                                    <el-table-column
                                            label="转移前储位"
                                            width="120"
                                            align="center"
                                            prop="beforeLocationName">
                                    </el-table-column>
                                    <el-table-column
                                            label="可转移数量"
                                            width="150"
                                            show-overflow-tooltip
                                            align="center"
                                            prop="zysZyBeforeKyCount">
                                    </el-table-column>
                                    <el-table-column
                                            label="转移后储位"
                                            width="120"
                                            show-overflow-tooltip
                                            align="center"
                                            prop="afterLocationName">
                                    </el-table-column>
                                    <el-table-column
                                            label="转移数量"
                                            width="120"
                                            show-overflow-tooltip
                                            align="center"
                                            prop="zysZyCount">
                                    </el-table-column>
                                    <!--<el-table-column-->
                                    <!--label="操作"-->
                                    <!--width="80">-->
                                    <!--<template scope="scope">-->
                                    <!--<el-button-->
                                    <!--@click="form_click_delete(scope.$index,scope.row)"-->
                                    <!--size="small"-->
                                    <!--type="danger"-->
                                    <!--icon="delete">-->
                                    <!--</el-button>-->
                                    <!--</template>-->
                                    <!--</el-table-column>-->
                                </el-table>
                            </el-carousel-item>
                        </el-carousel>
                    </template>
                </el-table-column>
                <el-table-column
                        label="创建时间"
                        show-overflow-tooltip
                        align="center">
                    <template scope="scope">
                        <span>
                            {{auto_time_new(scope.row.zyCreateTime)}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column
                        label="提起人"
                        show-overflow-tooltip
                        align="center"
                        prop="zyMentionUserName">
                </el-table-column>
                <el-table-column
                        label="创建人"
                        show-overflow-tooltip
                        align="center"
                        prop="zyCreateUserName">
                </el-table-column>
                <el-table-column
                        label="确认人"
                        show-overflow-tooltip
                        align="center"
                        prop="zyConfirmUserName">
                </el-table-column>
                <el-table-column
                        label="转移原因"
                        show-overflow-tooltip
                        align="center"
                        prop="zyReason">
                </el-table-column>
                <el-table-column
                        label="确认时间"
                        show-overflow-tooltip
                        align="center">
                    <template scope="scope">
                        <span>
                            {{auto_time_new(scope.row.zyConfirmTime)}}
                        </span>
                    </template>
                </el-table-column>
                <el-table-column
                        label="转移状态"
                        prop="zyStatus"
                        align="center"
                        width="100">
                    <template scope="scope">
                        <el-tag-s :val="auto_el_tag('zyStatus',scope.row.zyStatus)"></el-tag-s>
                    </template>
                </el-table-column>
                <el-table-column
                        v-if="multiSelect"
                        type="selection"
                        width="60">
                </el-table-column>
            </el-table>
            <div class="block">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="1"
                        :page-sizes="[5, 10, 15, 20, 100, 500, 1000, 5000, 10000]"
                        :page-size="pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="currentTotal">
                </el-pagination>
            </div>
        </el-col>
    </el-row>
    <el-dialog
            size="large"
            v-model="dialogFormVisible">
        <div class="dialog-title clearfix" slot="title">
            <span class="el-dialog__title">{{form.title}}</span>
            <el-steps
                    class="steps"
                    :space="120"
                    :active="dialogFormActive"
                    finish-status="finish">
                <el-step title="基础信息"></el-step>
                <el-step title="选择库存"></el-step>
            </el-steps>
        </div>
        <el-carousel
                ref="carousel"
                :autoplay="false"
                arrow="never"
                indicator-position="none"
                height="55vh">
            <el-carousel-item>
                <el-form
                        ref="ref_form"
                        :rules="rule_form"
                        :inline="true"
                        :model="form"
                        :label-width="formLabelWidth">
                    <el-form-item
                            prop="zyMentionUserName"
                            label="提起人">
                        <el-input
                                v-model="form.zyMentionUserName"
                                auto-complete="off"></el-input>
                    </el-form-item>
                    <el-form-item
                            prop="zyReason"
                            label="转移原因">
                        <el-input
                                v-model="form.zyReason"
                                auto-complete="off"></el-input>
                    </el-form-item>
                </el-form>
                <el-table
                        :data="form.data">
                    <el-table-column
                            type="index"
                            width="55">
                    </el-table-column>
                    <el-table-column
                            label="货品编号"
                            width="150"
                            show-overflow-tooltip
                            align="center"
                            prop="baseGoods.bgGoodsNo">
                    </el-table-column>
                    <el-table-column
                            label="货品名称"
                            show-overflow-tooltip
                            align="center"
                            prop="baseGoods.bgGoodsName">
                    </el-table-column>
                    <el-table-column
                            label="货品储位"
                            width="120"
                            align="center"
                            prop="baseLocation.blLname">
                    </el-table-column>
                    <el-table-column
                            label="可转移数量"
                            width="150"
                            show-overflow-tooltip
                            align="center"
                            prop="kyCount">
                    </el-table-column>
                    <el-table-column
                            label="目标储位"
                            width="120"
                            show-overflow-tooltip
                            align="center"
                            prop="baseLocation2.blLname">
                    </el-table-column>
                    <el-table-column
                            label="转移数量"
                            width="120"
                            show-overflow-tooltip
                            align="center"
                            prop="zysZyCount">
                    </el-table-column>
                    <el-table-column
                            label="操作"
                            width="80">
                        <template scope="scope">
                            <el-button
                                    @click="form_click_delete(scope.$index,scope.row)"
                                    size="small"
                                    type="danger"
                                    icon="delete">
                            </el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-carousel-item>
            <el-carousel-item>
                <el-card class="box-card">
                    <div slot="header" class="clearfix">
                        <div class="inner btn-nav">
                            <el-input
                                    v-model="form.select.blLname"
                                    icon="search"
                                    placeholder="库位名称"></el-input>
                            <el-input
                                    v-model="form.select.bgGoodsNo"
                                    icon="search"
                                    placeholder="货品编号"></el-input>
                            <el-input
                                    v-model="form.select.bgGoodsName"
                                    icon="search"
                                    placeholder="货品名称"></el-input>
                        </div>
                        <el-table
                                height="180"
                                @row-click="form_select_click"
                                :highlight-current-row="true"
                                :data="form.select.data">
                            <el-table-column
                                    type="index"
                                    width="55">
                            </el-table-column>
                            <el-table-column
                                    label="货品编号"
                                    width="150"
                                    show-overflow-tooltip
                                    align="center"
                                    prop="baseGoods.bgGoodsNo">
                            </el-table-column>
                            <el-table-column
                                    label="货品名称"
                                    show-overflow-tooltip
                                    align="center"
                                    prop="baseGoods.bgGoodsName">
                            </el-table-column>
                            <el-table-column
                                    label="规格"
                                    width="100"
                                    show-overflow-tooltip
                                    align="center"
                                    prop="mrCount">
                            </el-table-column>
                            <el-table-column
                                    label="单位"
                                    width="80"
                                    align="center"
                                    prop="baseDw.bdName">
                            </el-table-column>
                            <el-table-column
                                    label="货品储位"
                                    width="120"
                                    align="center"
                                    prop="baseLocation.blLname">
                            </el-table-column>
                            <el-table-column
                                    label="可转移数量"
                                    width="150"
                                    show-overflow-tooltip
                                    align="center"
                                    prop="kyCount">
                            </el-table-column>
                        </el-table>
                    </div>
                    <el-form
                            :inline="true"
                            v-model="form"
                            ref="ref_form2"
                            :label-width="formLabelWidth">
                        <el-form-item
                                label="目标储位"
                                :label-width="formLabelWidth">
                            <el-autocomplete
                                    :fetch-suggestions="queryLocationAsync"
                                    v-model="form.select.baseLocation.blLname"
                                    :disabled="form.select.sort.mrDwid==0||obj.form.select.sort.kyCount==0"
                                    @select="locationSelect"
                                    auto-complete="off"></el-autocomplete>
                        </el-form-item>
                        <el-form-item
                                label="调整数量"
                                :label-width="formLabelWidth">
                            <div class="block">
                                <el-slider
                                        :disabled="form.select.sort.mrDwid==0||obj.form.select.sort.kyCount==0"
                                        :max="form.select.sort.kyCount"
                                        v-model="form.select.zysZyCount"
                                        show-input>
                                </el-slider>
                            </div>
                        </el-form-item>
                        <el-form-item
                                :label-width="formLabelWidth">
                            <el-button
                                    size="small"
                                    @click="selectCof"
                                    :disabled="form.select.sort.mrDwid==0||form.select.baseLocation.blLname==''||obj.form.select.sort.kyCount==0||form.select.zysZyCount==0"
                                    type="info">确定
                            </el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </el-carousel-item>
        </el-carousel>

        <div slot="footer" class="dialog-footer">
            <el-button @click="submit" :loading="submitLoading" v-show="dialogFormActive==1"
                       :disabled="form.data.length==0">保存
            </el-button>
            <el-button type="primary" @click="selectALibrary" v-show="dialogFormActive==1">选择一条库存
            </el-button>
            <el-button type="primary" @click="selectReturn1" v-show="dialogFormActive==2">返回
            </el-button>
        </div>
    </el-dialog>
</div>
<script>
    var aLibraryTransfer = new Vue({
        el: '#aLibraryTransfer',
        prop: {},
        data: function () {
            return {
                watchView: false,
                baseArehouses: window.dbmessage.baseArehouses,
                aLibraryTransfer: [],
                multipleSelection: [],
                multiSelect: false,
                pickerOptions: {
                    shortcuts: [{
                        text: '最近一周',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近一个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
                            picker.$emit('pick', [start, end]);
                        }
                    }, {
                        text: '最近三个月',
                        onClick: function (picker) {
                            var end = new Date();
                            var start = new Date();
                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
                            picker.$emit('pick', [start, end]);
                        }
                    }]
                },
                showLoading: false,
                currentPage: 1,
                pageSize: 10,
                currentTotal: 0,
                date: [null, null],                 //主页面 选择日期 搜索
                zyMentionUserName: '',              //主页面 提起人 搜索
                zyCreateUserName: '',                //主页面 创建人 搜索
                zyStatus: '',                        //主页面 转移状态
                zyArehouseId: window.dbmessage.baseArehouses[0].baArehouseId,             //主页面 仓库 搜索
                formLabelWidth: '120px',            //表单 配置
                form: _form(),                      //表单 弹出层 信息集合
                rule_form: autoValidate(validate_form()), //编辑验证规则
                dialogFormActive: 1,                //新建 弹出层 steps 当前进度
                dialogFormVisible: false,           //新建 弹出层 是否可见
                submitLoading: false,               //新建 弹出层 提交等待
                select: _form_stock(),              //搜索 弹出层 信息集合,
                printf: [],                         //搜索 弹出层 信息集合,
                dialogSelectVisible: false,
                dialogPrintfVisible: false,
                selectLoading: false,
                printfLoading: false,

                printDatas: [],                     // 打印数据
            }
        },
        computed: {
            // TODO 表格提交
            option: function () {
                return {
                    "draw": 1,
                    "pageNum": this.currentPage,
                    "pageSize": this.pageSize,
                    "zyMentionUserName": this.zyMentionUserName.trim(),
                    "zyCreateUserName": this.zyCreateUserName.trim(),
                    "zyArehouseId": this.zyArehouseId,
                    "zyStatus": this.zyStatus,
                    "startCreateTimeParam": tsf_date(this.date[0]),
                    "endCreateTimeParam": tsf_date(this.date[1]),
                }
            },
            option_form: function () {
                return {
                    "pageNum": 1,
                    "pageSize": 10,
                    "draw": 0,
                    blLname: this.form.select.blLname,
                    bgGoodsNo: this.form.select.bgGoodsNo,
                    mrArehouseId: window.dbmessage.baseArehouses[0].baArehouseId,
                    bgGoodsName: this.form.select.bgGoodsName
                }
            },
            search: function () {
                return {
                    "draw": 1,
                    "pageNum": this.currentPage,
                    "pageSize": this.pageSize,
                    "rkrwN": this.form.rkrwN,
                    "rkrwCph": this.form.rkrwCph,
                    "dds": this.form.dds,
                    "pxs": this.form.pxs,
                    "rkrwSjxm": this.form.rkrwSjxm,
                    "rkrwDhrq": this.form.rkrwDhrq,
                    "rkrwDbd": this.form.rkrwDbd,
                    "rkrwCys": this.form.rkrwCys,
                    "rkrwDh": this.form.rkrwDh,
                    "rkrwStatus": this.form.rkrwStatus
                }
            },
        },
        methods: {
            expandChange: function (row, expanded) {
                if (expanded && (typeof (row.mfunckDoc) === 'undefined' || row.mfunckDoc === null || row.mfunckDoc.length === 0)) {
                    p[7].post({
                        id: row.zyId
                    }, function (json) {
                        /*<debug>*/
                        console.log(json);
                        /*</debug>*/
                        row.zyDocsList = json.zyDocsList;
                    });
                }
            },
            inlineDelete: function (index, row) {
                var _this = this;
                _this.$confirm('此操作将删除库存转移单据, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(function () {
                    p[103].post({
                        "ids": [
                            row.zyId
                        ],
                        "useId": app.rmsUser.ruUserId,
                        "userName": app.rmsUser.ruUserName
                    }, function (json) {
                        this.callbackAfter(json, function () {
                            remove(row, _this.aLibraryTransfer);
                        })
                    })
                }).catch(function () {
                    _this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },                                //TODO 行内按钮-删除
            inlineEdit: function (index, row) {
                this.form.title = '编辑';
                obj.dialogFormVisible = true;
                obj.dialogFormActive = 1;
                if (obj.$refs.carousel) obj.$refs.carousel.setActiveItem(0);

            },                                  //TODO 行内按钮-编辑
            inlineModify: function (index, row) {
                this.multipleSelection = [row];
                printfCompile(this);
                this.dialogPrintfVisible = !this.dialogPrintfVisible;
            },                                //行内按钮 打印标签页
            multiSelectClick: function () {
                this.multiSelect = !this.multiSelect;
            },                                      //多选 状态维护
            multiSelectionChange: function (val) {
                /*<debug>*/
                console.log(this.multipleSelection);
                /*</debug>*/
                this.multipleSelection = val;
            },                               //多选 选中控制
            multiMoreOperationDelete: function () {
                var _this = this;
                _this.$confirm('此操作将删除库存转移单据, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(function () {
                    remove(row, _this.recoveryArchive);
                    postDelete(_this, {
                        id: [row.rkdjNo]
                    });
                }).catch(function () {
                    _this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
//                /*<debug>*/
//                console.log('选中的删除');
//                /*</debug>*/
//                for (i = 0; i < this.multipleSelectionCombination.length; i++) {
//                    remove(this.multipleSelectionCombination[i], this.warehousingReservationCombination);
//                }
            },                              //TODO 多选 删除
            newInput: function () {
                this.form = _form();
                this.dialogFormVisible = true;
                this.dialogFormActive = 1;
                Vue.nextTick(function () {
                    aLibraryTransfer.$refs.carousel.setActiveItem(0);
                });
            },
            handleSizeChange: function (val) {
                /*<debug>*/
                console.log('每页' + val + '条');
                /*</debug>*/
                this.pageSize = val;
                p[0].post(this.option);
            },                                   //分页 Size
            handleCurrentChange: function (val) {
                /*<debug>*/
                console.log('当前第' + val + '页');
                /*</debug>*/
                this.currentPage = val;
                p[0].post(this.option);
            },                                //分页 当前页
            prev: function () {
                this.dialogFormActive--;
                this.$refs.carousel.prev();
            },                                                  //新建 弹出层banner控制 前一个
            next: function () {
                this.dialogFormActive++;
                this.$refs.carousel.next();
            },                                                  //新建 弹出层banner控制 后一个
            submit: function () {
                this.$refs.ref_form.validate(function (valid) {
                    if (valid) {
                        obj.form.zyDocsList = [];
                        for (var i = 0; i < obj.form.data.length; i++) {
                            var step = _form_select_post();
                            step.zysRepertoryId = obj.form.data[i].mrRepertoryId;
                            step.zysZyAfterLocationId = obj.form.data[i].baseLocation2.blLocationId;
                            step.zysZyBeforeKyCount = obj.form.data[i].kyCount;
                            step.zysZyBeforeLocationId = obj.form.data[i].baseLocation.blLocationId;
                            step.zysZyCount = obj.form.data[i].zysZyCount;
                            obj.form.zyDocsList.push(step);
                        }
                        delete obj.form.select;
                        delete obj.form.data;
                        delete obj.form.title;
                        p[1].post(obj.form, function (json) {
                            this.callbackAfter(json, function () {
                                obj.dialogFormVisible = false;
                                obj.dialogFormActive = 1;
                                obj.$refs.carousel.setActiveItem(0);
                                p[0].post(obj.option);
                            })
                        });
                        obj.form = _form();
                    } else {
                        return false;
                    }
                });
            },                                                //新建 表单提交

            selectALibrary: function () {
                if (!imClear) {
                    obj.$confirm('这里的显示，并没有显示全，如果没找到，请使用查询，进行查询', '提示', {
                        confirmButtonText: '我知道了，别再烦我',
                        cancelButtonText: '下次还提示',
                        type: 'warning'
                    }).then(function () {
                        imClear = true;
                    }).catch(function () {
                        imClear = false;
                    });
                }
                obj.$refs.carousel.next();
                obj.dialogFormActive++;
            },                                        //选择一条库存
            selectReturn1: function () {
                obj.$refs.carousel.prev();
                obj.dialogFormActive--;
            },                                          //取消选择一条库存

            queryLocationAsync: function (queryString, cb) {
                p[104].post({
                    "pageNum": 1,
                    "pageSize": 10,
                    "draw": 0,
                    blLName: queryString,
                    arehouseId: window.dbmessage.baseArehouses[0].baArehouseId
                }, function (json) {
                    json = json.data;
                    var step = [];
                    var length = json.length > 20 ? 20 : json.length;
                    for (var i = 0; i < length; i++) {
                        step.push({data: json[i], value: json[i].blLname})
                    }
                    cb(step);
                });
            },
            locationSelect: function (item) {
                this.form.select.baseLocation = item.data;
            },
            selectCof: function () {
                p[104].post({
                    "pageNum": 1,
                    "pageSize": 1,
                    "draw": 0,
                    blLName: obj.form.select.baseLocation.blLname,
                    arehouseId: window.dbmessage.baseArehouses[0].baArehouseId
                }, function (json) {
                    if (json.data.length === 1 && json.data[0].blLocationId === obj.form.select.baseLocation.blLocationId) {
                        _step();
                    } else if (json.data.length === 1) {
                        obj.form.select.baseLocation = json.data[0];
                        _step();
                    } else {
                        obj.$notify({
                            title: '失败',
                            message: '储位未能找到！',
                            type: 'error'
                        });
                        return false;
                    }
                    function _step() {
                        var step = obj.form.select.sort;
                        step.zysZyCount = obj.form.select.zysZyCount;
                        step.baseLocation2 = obj.form.select.baseLocation;

                        obj.form.data.push(step);

                        obj.form.select = _form_select();
                        obj.selectReturn1();
                    }
                });
            },


            form_select_click: function (row, event, column) {
                this.form.select.sort = row;
            },
            form_click_delete: function (index, row) {
                remove(row, this.form.data);
            },
            auto_zyStatus: function (value) {
                var temp = {}
                if (!isNaN(value)) {
                    temp = {
                        0: '未确认',
                        1: '确认',
                        2: '作废',
                    }
                } else {
                    temp = {
                        '未确认': 0,
                        '确认': 1,
                        '作废': 2
                    }
                }
                return temp[value];
            },                                    //转移状态
        },
        watch: {
            zyMentionUserName: function () {
                /*<debug>*/
                console.log(this.option);
                /*</debug>*/
                p[0].post(this.option);
            },
            zyCreateUserName: function () {
                /*<debug>*/
                console.log(this.option);
                /*</debug>*/
                p[0].post(this.option);
            },
            zyStatus: function () {
                /*<debug>*/
                console.log(this.option);
                /*</debug>*/
                p[0].post(this.option);
            },
            zyArehouseId: function () {
                /*<debug>*/
                console.log(this.option);
                /*</debug>*/
                p[0].post(this.option);
            },


        }
    });
    // 高级 监视器的 使用方法
    aLibraryTransfer.$watch('date', function () {
        /*<debug>*/
        console.log(this.option);
        /*</debug>*/
        p[0].post(this.option);
    }, {deep: true});
    aLibraryTransfer.$watch('form.select.blLname', function () {
        p[8].post(this.option_form);
    }, {deep: true});
    aLibraryTransfer.$watch('form.select.bgGoodsNo', function () {
        p[8].post(this.option_form);
    }, {deep: true});
    aLibraryTransfer.$watch('form.select.bgGoodsName', function () {
        p[8].post(this.option_form);
    }, {deep: true});


    function validate_form() {
        return {
            zyMentionUserName: 'vNull',
            zyReason: 'vNull'
        }
    }

    function _form() {
        return {
            data: [],
            title: '新建库存转移',

            select: _form_select(),

            "zyMentionUserName": "",
            "zyReason": "",
            "zyCreateUserId": app.rmsUser.ruUserId,
            "zyCreateUserName": app.rmsUser.ruUserName,
            "zyArehouseId": window.dbmessage.baseArehouses[0].baArehouseId,


        }
    }
    function _form_stock() {
        return {
            zyCreateUserName: '',
            zyReason: '',
            zyConfirmTime: '',

            zyCreateTime: [null, null],//模糊查询--创建日期
            zyStatus: '',//模糊查询--转移状态
            zyMentionUserName: '',//模糊查询--提起人
            zyConfirmUserName: ''//模糊查询--确认人
        }
    }
    function _form_select() {
        return {
            data: [],
            zysZyCount: 0,
            baseLocation: {
                blLocationId: 1,
                blLname: ''
            },
            sort: {
                mrDwid: 0,
                kyCount: 0
            },


            blLname: '',
            bgGoodsNo: '',
            bgGoodsName: ''
        }
    }
    function _form_select_post() {
        return {
            "zysRepertoryId": 0,
            "zysZyBeforeLocationId": 0,
            "zysZyAfterLocationId": 0,
            "zysZyBeforeKyCount": 0,
            "zysZyCount": 0
        }
    }

    var obj = aLibraryTransfer;
    var p = [];

    // 0 库存转移 分页查询
    p[0] = autoPost({
        urlHock: "../../hock/aLibraryTransfer/page.json",
        urlProd: "/route/aLibraryTransfer/0",
        success: function (json) {
            obj.$data.aLibraryTransfer = json.data;
            obj.$data.currentTotal = json.recordsFiltered;
        }
    });

    // 1 库存转移 新增
    p[1] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/1",
        method: 'GET'
    });

    // 2 库存转移 编辑
    p[2] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/2",
        success: function (json) {
        }
    });

    // 3 库存转移 分页 根据货品id 库位id 仓库id 合并获取库存单据
    p[3] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/3",
        success: function (json) {
        }
    });

    // 5 库存转移 分页获取库存转移单据(包含详细信息)
    p[5] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/5",
        success: function (json) {
        }
    });


    // 7 库存转移 通过库存转移单据id获取一条库存转移单据
    p[7] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/7",
        method: 'GET'
    });

    // 8 库存转移 查询 合并后的库存
    p[8] = autoPost({
        urlHock: "",
        urlProd: "/route/aLibraryTransfer/8",
        success: function (json) {
            obj.form.select.data = json.data;
        }
    });

    p[0].post(aLibraryTransfer.option);


    // 101 库存查询 分页查询
    p[101] = autoPost({
        urlHock: "/hock/stockSelect/page.json",
        urlProd: "/route/stockSelect/0",
        success: function (json) {
            obj.$data.stockSelect = json.data;
            obj.$data.currentTotal = json.recordsFiltered;
        }
    });
    // 102 库存查询 导出
    p[102] = autoPost({
        urlHock: "",
        urlProd: "/route/stockSelect/1",
        method: "GET",
        success: function (json) {
        }
    });
    // 103 库存转移确认 通过库存转移单据id删除库存转移单据
    p[103] = autoPost({
        urlHock: "",
        urlProd: "/route/stockTransferConfirm/5",
        method: 'GET'
    });
    // 104 查询-储位
    p[104] = autoPost({
        urlHock: "/hock/inputOption/location.json",
        urlProd: "/route/inputOperation/5"
    });
</script>


